/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.hanze.shoestring.domain;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author qrazi
 */
@Entity
@Table(name = "deelnemer")
@XmlRootElement
@NamedQueries({
	@NamedQuery(name = "Deelnemer.findAll", query = "SELECT d FROM Deelnemer d"),
	@NamedQuery(name = "Deelnemer.findById", query = "SELECT d FROM Deelnemer d WHERE d.id = :id"),
	@NamedQuery(name = "Deelnemer.findByBedrag", query = "SELECT d FROM Deelnemer d WHERE d.bedrag = :bedrag"),
	@NamedQuery(name = "Deelnemer.findByDieet", query = "SELECT d FROM Deelnemer d WHERE d.dieet = :dieet"),
	@NamedQuery(name = "Deelnemer.findByVerlenging", query = "SELECT d FROM Deelnemer d WHERE d.verlenging = :verlenging")})
public class Deelnemer implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
	private Integer id;
	@Basic(optional = false)
    @NotNull
    @Column(name = "bedrag")
	private float bedrag;
	@Basic(optional = false)
    @NotNull
    @Column(name = "dieet")
	private boolean dieet;
	@Basic(optional = false)
    @NotNull
    @Column(name = "verlenging")
	private boolean verlenging;
	@JoinColumn(name = "reservering_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
	private Reservering reserveringId;
	@JoinColumn(name = "klant_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
	private Klant klantId;

	public Deelnemer() {
	}

	public Deelnemer(Integer id) {
		this.id = id;
	}

	public Deelnemer(Integer id, float bedrag, boolean dieet, boolean verlenging) {
		this.id = id;
		this.bedrag = bedrag;
		this.dieet = dieet;
		this.verlenging = verlenging;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public float getBedrag() {
		return bedrag;
	}

	public void setBedrag(float bedrag) {
		this.bedrag = bedrag;
	}

	public boolean getDieet() {
		return dieet;
	}

	public void setDieet(boolean dieet) {
		this.dieet = dieet;
	}

	public boolean getVerlenging() {
		return verlenging;
	}

	public void setVerlenging(boolean verlenging) {
		this.verlenging = verlenging;
	}

	public Reservering getReserveringId() {
		return reserveringId;
	}

	public void setReserveringId(Reservering reserveringId) {
		this.reserveringId = reserveringId;
	}

	public Klant getKlantId() {
		return klantId;
	}

	public void setKlantId(Klant klantId) {
		this.klantId = klantId;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are not set
		if (!(object instanceof Deelnemer)) {
			return false;
		}
		Deelnemer other = (Deelnemer) object;
		if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return getKlantId().getPersoon().getAchternaam();
	}
	
}
